package config

import (
	"io/ioutil"
	"net/http"
	"strings"
)

const (
	ViewRootPath = "res/view/"
)

var LocalIP = ""

func GetIP() (ip string, err error) {
	resp, err := http.Get("http://myexternalip.com/raw")
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	//io.Copy(os.Stdout, resp.Body)
	bytes, err := ioutil.ReadAll(resp.Body)
	LocalIP = strings.Replace(string(bytes), "\n", "", -1)
	return LocalIP, err
}
